<%@page import="java.sql.*" %>
<%@page import="com.mysql.jdbc.*" %>
<%@page import="java.lang.*" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%

    String username = request.getParameter("username");
    String password =request.getParameter("password");
       if (username==null||password==null||username.equals("")|| password.equals("") ) {
        response.sendRedirect("login.jsp");
        return;
    }
    username = new String(username.getBytes("ISO-8859-1"),"UTF-8");

 
    
%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>后台管理</title>
    </head>
    <body style="background-color: #D5EBFF;margin-top: 0px">
        <%
            String driverName = "com.mysql.jdbc.Driver";
            String userName = "root";
            String userPasswd = "1";
            String dbName = "zjcwkj";
            String dbTable;
            String SQL = "select count(username) from users where username=" + "'" + username + "' && password='" + password + "'";
            String url = "jdbc:mysql://localhost/" + dbName + "?user=" + userName + "&password=" + userPasswd;
            Class.forName("com.mysql.jdbc.Driver");
            java.sql.Connection connection = DriverManager.getConnection(url);
            java.sql.Statement statement = connection.createStatement();
            ResultSet rs = statement.executeQuery(SQL);
            rs.next();
            int n = rs.getInt(1);
            if (n == 0) {
                session.setAttribute("login", "false");
                response.sendRedirect("login.jsp");
                return;
            }
            session.setAttribute("login", "true");
            rs.close();

        %>
        <div>
            <table>
                <tr>
                    <td colspan="2">
                        <img src="/zjcwkj/images/adminlogo.png" alt="后台管理" />
                    </td>
                </tr>
                <tr>
                    <td width="150px" valign="top" >
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=1" target="content">课程首页</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=2" target="content">课程简介</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=3" target="content">教师队伍</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=4" target="content">教学大纲</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=5" target="content">教案与课件</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=6" target="content">教学视频</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=7" target="content">习题与样题</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=8" target="content">课程实验与实践</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=9" target="content">参考资源</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=10" target="content">在线答疑</a></li>
                <li style="list-style-type: none"><a class="a" href="control.jsp?id=11" target="content">修改密码</a></li>
                </td>
                <td width="1000px">
                    <iframe name="content" id="content" height="650px" width="1000px" frameborder="0" ></iframe>
                </td>  
                </tr>
            </table>
        </div>
    </body>
</html>
